package com.zhang.bingmei_incomeexpenditure.service.strategy.Impl;

import com.zhang.bingmei_incomeexpenditure.entity.Utils.SecurityPlusUtils;
import com.zhang.bingmei_incomeexpenditure.entity.commom.DataScope;
import com.zhang.bingmei_incomeexpenditure.service.strategy.DataScopeStrategy;

import java.util.Collections;
import java.util.List;

// 区级管理员策略（角色4）
public class DistrictDataScopeStrategy implements DataScopeStrategy {
    @Override
    public DataScope getAreaPrefix() {
        String area = SecurityPlusUtils.getArea();
        DataScope dataScope = new DataScope();
        dataScope.setArea(area);
        dataScope.setMinLevel(4);
        return dataScope;
    }

    @Override
    public List<String> buildFullDistrictCodes(List<String> districtSuffixList) {
        String prefix = getAreaPrefix().getArea();
        // JDK1.8替代List.of(prefix)，双重判断简化为单返回（逻辑不变）
        return Collections.singletonList(prefix);
    }

    @Override
    public int supportRoleLevel() {
        return 4;
    }
}
